
var objectId, content, value, highestValue, app = getApp();

Page({
    data: {
        showView: !0,
        showSize: !0,
        brandName: "",
        currentPrice: 0,
        numHide: 0,
        disabledInput: !1
    },
    onLoad: function(options) {
     
        objectId = options.objectId?options.objectId:"";
        content = options.content?options.content:"";
        this.setData({
            objectId:objectId,
            content:content
        })
    },
    onShow: function(t) {
       
    },
   
    priceInputLowest: function(a) { 
        var that = this;
        value = a.detail.value;
       
        that.setData({
            lowest: a.detail.value,
            active: "active"
        });
    },
    priceInputHighest: function(a) {
        var that = this;
        highestValue = a.detail.value;
     
        that.setData({
            highest: a.detail.value,
            active: "active"
        });
    },
    
    formSubmit: function(options) {
        var that=this;
        var price_max=options.detail.value.price_max;
        var price_min=options.detail.value.price_min;
        if(!this.isRealNum(price_max)||!this.isRealNum(price_min)){
            wx.showToast({
                title: "区间值必须为数字",
                image: "../../images/failure.png",
                duration: 2e3
            })
        }
        //区间值
        if(price_max<price_min){
            wx.showToast({
                title: "区间值不正确",
                image: "../../images/failure.png",
                duration: 2e3
            })
        }

        wx.redirectTo({
            url: "../category/list?id=" + this.data.objectId + "&content=" + this.data.content + "&filter_attr=" + price_min+","+price_max
        });
    },

    isRealNum:function (val){
        // isNaN()函数 把空串 空格 以及NUll 按照0来处理 所以先去除
        if(val === "" || val ==null){
            return false;
        }
        if(!isNaN(val)){
            return true;
        }else{
            return false;
        }
    }           
    
});